<h1>Categor&iacute;as</h1>

<% unless flash[:success].blank? %>
    <div class="success-box"><p><%= flash[:success] %></p></div>
<% end %>

<% unless flash[:fail].blank? %>
<div class="errors-box" style="display: block !important; margin-bottom: 10px;">
    <span><%= flash[:fail] %></span>
</div>
<% end %>

<% unless @categories.blank? %>
    <%= form_tag update_categories_order_path do %>

    <table>
      <% @categories.each do |category| %>
        <tr>
            <td><%= text_field_tag "categories[#{category.id}]", category.listing_order, :style => 'width: 60px;' %></td>
            <td><%= category.name %></td>
        </tr>
      <% end %>
    </table>

    <p><%= submit_tag 'Guardar' %></p>

    <% end %>
<% else %>
    <span>No hay categor&iacute;as cargadas.</span>
<% end %>

<p><%= link_to 'Crear Categoría', new_admin_category_url %></p>